package com.zhongjian.technologycal.mall.view;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zhongjian.technologycal.mall.R;

public class GetDialog {
	private Dialog calculateDialog = null;
	private String tender = "10000";
	private String apr = "22";
	private String time = "1";
	private int repayment_type = 1;
	private Boolean isDay = false;
	private EditText calculate_et_money;
	private TextView calculate_tv_earn;

	private Dialog hintDialog = null;
	public Dialog getHintDialog(final Context context,
								final View.OnClickListener ensureListener, final CharSequence hint,
								final boolean isCancel) {
		hintDialog = new Dialog(context, R.style.dialog_hint_style) {
			LinearLayout layout;
			@Override
			protected void onCreate(Bundle savedInstanceState) {
				super.onCreate(savedInstanceState);
				LayoutInflater inflater = (LayoutInflater) context
						.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
				layout = (LinearLayout) inflater.inflate(R.layout.dialog_style,
						null);
				if (isCancel) {
					layout.findViewById(R.id.dialog_btn_cancel).setVisibility(
							View.VISIBLE);
				} else {
					layout.findViewById(R.id.dialog_btn_cancel).setVisibility(
							View.GONE);
				}
				layout.findViewById(R.id.dialog_btn_cancel).setOnClickListener(
						new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								hintDialog.dismiss();
							}
						});
				layout.findViewById(R.id.dialog_btn_ensure).setOnClickListener(
						ensureListener);
				TextView tv_title = (TextView) layout
						.findViewById(R.id.dialog_tv_title);
				if (!isCancel) {
					tv_title.setVisibility(View.GONE);
				}
				TextView tv_hint = (TextView) layout
						.findViewById(R.id.tv_txtContent);
				tv_hint.setText(hint);
				setContentView(layout);
			}

		};
		return hintDialog;
	}

//	private Dialog overdueDialog = null;

//	public Dialog getOverdueDialog(final Context context) {
//		overdueDialog = new Dialog(context, R.style.dialog_style) {
//			LinearLayout layout;
//
//			@Override
//			protected void onCreate(Bundle savedInstanceState) {
//				super.onCreate(savedInstanceState);
//				LayoutInflater inflater = (LayoutInflater) context
//						.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//				layout = (LinearLayout) inflater.inflate(R.layout.dialog_hint,
//						null);
//				layout.findViewById(R.id.dialog_btn_cancel).setVisibility(
//						View.GONE);
//				layout.findViewById(R.id.dialog_btn_cancel).setOnClickListener(
//						new View.OnClickListener() {
//
//							@Override
//							public void onClick(View v) {
//								overdueDialog.dismiss();
//							}
//						});
//				layout.findViewById(R.id.dialog_btn_ensure).setOnClickListener(
//						new View.OnClickListener() {
//
//							@Override
//							public void onClick(View v) {
//								context.startActivity(new Intent(context,
//										LoginAct.class));
//								overdueDialog.dismiss();
//							}
//						});
//				TextView tv_title = (TextView) layout
//						.findViewById(R.id.dialog_tv_title);
//				tv_title.setVisibility(View.GONE);
//				TextView tv_hint = (TextView) layout
//						.findViewById(R.id.dialog_tv_hint);
//				tv_hint.setText(context.getString(R.string.login_overdue));
//				setContentView(layout);
//			}
//
//		};
//		return overdueDialog;
//	}

//	private Dialog repaymentDialog = null;

//	@SuppressWarnings("deprecation")
//	public Dialog getRePaymentDialog(Context context,
//			AdapterView.OnItemClickListener itemClickListener, String title,
//			String[] array) {
//		repaymentDialog = new Dialog(context,
//				R.style.pic_choose_dialog_progress);
//		View view = LayoutInflater.from(context).inflate(
//				R.layout.dialog_repayment, null);
//		ListView listView = (ListView) view.findViewById(R.id.repayment_list);
//		listView.setOnItemClickListener(itemClickListener);
//		TextView tv_title = (TextView) view
//				.findViewById(R.id.repayment_dialog_title);
//		tv_title.setText(title);
//		RepaymentAdapter adapter = new RepaymentAdapter(context, array);
//		listView.setAdapter(adapter);
//		Window window = repaymentDialog.getWindow();
//		window.setContentView(view);
//		window.setGravity(Gravity.BOTTOM);
//		window.setLayout(android.view.WindowManager.LayoutParams.FILL_PARENT,
//				android.view.WindowManager.LayoutParams.WRAP_CONTENT);
//		window.setWindowAnimations(R.style.popup_anim_style);
//		repaymentDialog.setCanceledOnTouchOutside(true);
//		return repaymentDialog;
//	}


}
